package com.notice.service;

import com.order.hit.crossover.platform.common.bean.Notice;
import com.notice.mapper.NoticeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Qualifier("NoticeServiceImpl")
public class NoticeServiceImpl implements NoticeService
{

    @Autowired
    private NoticeMapper noticeMapper;


    @Override
    public List<Notice> selectAll()
    {
        return noticeMapper.selectAll();
    }

    @Override
    public Notice selectbyNoticeId(Long noticeId)
    {
        return noticeMapper.selectbyNoticeId(noticeId);
    }

    @Override
    public List<Notice> selectbyStoreId(String storeId, int noticeType)
    {
        return noticeMapper.selectbyStoreId(storeId, noticeType);
    }

    @Override
    public List<Notice> selectUnreadOfStore(String storeId, int noticeType)
    {
        return noticeMapper.selectStatebyStoreId(storeId, 0, noticeType);
    }

    @Override
    public List<Notice> selectReadOfStore(String storeId, int noticeType)
    {
        return noticeMapper.selectStatebyStoreId(storeId, 1, noticeType);
    }

    @Override
    public void add(Notice notice)
    {
        noticeMapper.add(notice);
    }

    @Override
    public void update(Notice notice)
    {
        noticeMapper.update(notice);
    }

    @Override
    public void updatestate(Long noticeId) {
        noticeMapper.updatestate(noticeId);
    }

    @Override
    public void deletebyNoticeId(Long noticeId)
    {
        noticeMapper.deletebyNoticeId(noticeId);
    }
}
